package com.app.designpatternslearn.behavior.mediatorpattern.code

class Mediator {

    private val nodes = hashMapOf<String, AbstractNode>()

    fun addNode(name: String, node: AbstractNode) {
        nodes[name] = node
    }

    fun sendMessage(from: String, to: String, message: String) {

        val node = nodes[to]

        node?.receiveMessage(from, message)

    }

}